<template>
  <div class="app-container">
    <el-table v-loading="loading" :data="agreementList">
      <el-table-column label="名称" align="center" prop="agreementName" />
      <!-- <el-table-column label="内容" align="center" prop="agreementContent" /> -->
      <el-table-column label="操作" align="center" class-name="small-padding fixed-width">
        <template slot-scope="scope">
          <el-button
            size="mini"
            type="text"
            icon="el-icon-edit"
            @click="handleUpdate(scope.row)"
            v-hasPermi="['system:agreement:edit']"
          >编辑</el-button>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>

<script>
import { listAgreement } from "@/api/system/agreement";

export default {
  name: "Agreement",
  data() {
    return {
      // 遮罩层
      loading: true,
      // 协议表格数据
      agreementList: []
    };
  },
  created() {
    this.getList();
  },
  methods: {
    /** 查询协议列表 */
    getList() {
      listAgreement().then(response => {
        this.agreementList = response.rows;
        this.loading = false;
      });
    },

    /** 修改按钮操作 */
    handleUpdate(row) {
      this.$router.push({
        name: "AgreementEdit",
        query: {
          id: row.id
        }
      });
    }
  }
};
</script>
